<template>
  <AreaBaseInfo :info="this.detail"></AreaBaseInfo>
</template>
<script>
import AreaBaseInfo from '../../../../../components/common/ui/areaBaseInfo.vue'
import base from '../../../../../assets/scripts/base/base'

export default {
  name: 'scds_alarmDetail',
  components: {
    AreaBaseInfo
  },
  props: ['summary'],
  data: function () {
    return {
      detail: {},
      base: base()
    }
  },
  watch: {
    summary: function (val) {
      const obj = {}
      if (!this.base.isEmptyObject(val)) {
        const { deptName, address } = val
        obj.title = deptName
        obj.subTitle = address
        obj.list = this.getList(val)
      }
      this.detail = Object.assign({}, obj)
    }
  },
  methods: {
    getList: function (val) {
      const {
        geoMntCount,
        wellCoverCount,
        dustbinCount,
        smokeSensorCount,
        pensionSetCount,
        environmentalPerceptionCount
      } = val
      const list = [{
        title: '垃圾桶', value: dustbinCount, iconType: 5
      }, {
        title: '环境感知', value: environmentalPerceptionCount, iconType: 8
      }, {
        title: '地磁', value: geoMntCount, iconType: 4
      }, {
        title: '养老五件套', value: pensionSetCount, iconType: 9
      }, {
        title: '烟感', value: smokeSensorCount, iconType: 7
      }, {
        title: '井盖', value: wellCoverCount, iconType: 6
      }]
      return list
    }
  }
}
</script>
